class CPU:
    pass


class Disk:
    pass


class Computer:
    def __init__(self, cpu, disk):
        self.cpu = cpu
        self.disk = disk

cpu = CPU()
disk = Disk()

com1 = Computer(cpu, disk)
com2 = com1

print(com1, '子对象的内存地址', com1.cpu, com1.disk)
print(com2, '子对象的内存地址', com2.cpu, com2.disk)

print('-' * 40)

# 导入copy模块
import copy

# 浅拷贝
com3 = copy.copy(com1)
# 深 拷贝
com4= copy.deepcopy(com1)
print(com1, '子对象的内存地址', com1.cpu, com1.disk)
print(com3, '子对象的内存地址', com3.cpu, com3.disk)
print(com4, '子对象的内存地址', com4.cpu, com4.disk)
